package github.data_structure.list;

/**
 * @Author: DRevelation
 * @Date: 2020/12/24 20:36
 * 单链表
 */
public class SinglyLinkedList<T> implements LList<T> {

    public Node<T> head;

    /**
     * 默认构造方法构造空单链表。创建头结点，data和next值均为null
     */
    public SinglyLinkedList() {
        this.head = new Node<T>();
    }

    /**
     * 以节点元素构造单链表
     * @param element
     */
    public SinglyLinkedList(T[] element) {
        this();
        Node<T> rear = this.head;
        for (int i = 0; i < element.length; i++) {
            rear.next = new Node<T>(element[i], null);
            rear = rear.next;
        }
    }

    @Override
    public boolean isEmpty() {
        return false;
    }

    @Override
    public int length() {
        return 0;
    }

    @Override
    public T get(int i) {
        return null;
    }

    @Override
    public void set(int i, T x) {

    }

    @Override
    public void insert(int i, T x) {

    }

    @Override
    public void append(T x) {

    }

    @Override
    public T remove(int i) {
        return null;
    }

    @Override
    public void removeall() {

    }

    @Override
    public T search(T key) {
        return null;
    }
}
